feat(backtest): 매집 점수 신호 검증 + 포트폴리오 커버 이미지#1
Merged
Conversation
형성구간(12거래일)에서 점수화한 후보를 보유구간 실제 수익률로 평가하는
간이 검증을 추가. 순위상관(scipy 비의존)·점수 분위별 평균 수익률 요약과
kq-backtest CLI 제공. README 커버용 그림 3종(랭킹·검증·종목 수급)을
scripts/make_figures.py 로 재현 가능하게 생성.
- strategies/backtest.py: forward_returns / backtest / spearman + CLI
- viz/portfolio.py: 랭킹 막대, 점수↔수익률 2패널
- scripts/make_figures.py: docs/images/{ranking,backtest,candidate}.png
- tests/test_backtest.py: split·forward_returns·spearman·예외 (5)
- 시장 색상 버그 수정: DB는 '거래소'/'코스닥' 한글 저장 (영문 비교 오류)
- .gitignore: README 이미지(docs/images/*.png) 추적 예외
younghwan91
force-pushed
the
feat/portfolio-figures
branch
from
June 14, 2026 14:16
3dd4671 to
fa00c00
Compare
younghwan91
added a commit
that referenced
this pull request
Jul 10, 2026
Fast-swing spec (2R target, 5% stop, <=4wk): LightGBM classifier predicts per breakout "hits +10% before -5% within 20 days?". 30 point-in-time features: 8-investor accumulation (20/60d), momentum, Minervini trend template (MA50/150/200, 52w hi/lo distance), volume contraction/surge, ATR, EPS-YoY fundamentals, size. Walk-forward 2020-2026: ML top-20% lifts win-rate 32% -> 37%, clearing the 33.3% 2R breakeven => E[R] +0.11R, 5/7 years positive (first positive version in the fast-swing style). eps_yoy is the #1 feature (fundamentals help: +0.11 vs +0.09 without). Edge modest (AUC ~0.54); weak in 2022/2024. feature_store.py caches all 30 features for every (code,date) to features.parquet (~2.08M rows, 224MB, zstd, point-in-time) so experiments load instead of recompute (kills the recompute-in-loop bug class). Labels derive cheaply from daily_bars. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G9PajF4kqhUaa6DvohPdm3
younghwan91
added a commit
that referenced
this pull request
Jul 12, 2026
ablation으로 확인된 유일한 유해 규칙(0.76→0.58 저하 전부 이 버그 때문). 상장 이후 모든 ≥12% 눌림을 무제한 누적(stage 12-36)하던 버그를, 트렌드템플릿과 동일한 25% 임계로 "약세장급 하락 후 리셋"하도록 수정 — Minervini 원문 "약세장이나 조정장 이후 처음 형성되는 베이스"에 정확히 대응. 두번째 버그도 함께 발견·수정: 딥리셋에서 벗어나는 순간 in_correction이 크래시 이전 잔여 고점(20일 롤링윈도)에 걸려 새 베이스를 못 세던 문제 — 리셋 직후 바를 "Base #1 시작"으로 명시 처리. 합성 테스트(딥리셋 발화/불발화) 2개 추가, 회귀없음. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
younghwan91
added a commit
that referenced
this pull request
Jul 17, 2026
research/RESEARCH_STATUS.md(에이전트 인수인계 문서) 삭제. 참조를 남기면 오늘 고친 "끊긴 참조" 문제가 재발하므로 전부 정리: - README.md:5·40 링크 2개 → research/MULTI_ALPHA.md - docs/backtest-engine.md:40 발표 수치 출처 목록에서 제외 - pead_refinement.py의 _update_handoff() 제거 — 삭제된 파일에 쓰던 함수라 다음 실행 시 크래시했을 것 (호출부 포함) - "HANDOFF caveat #1" → MULTI_ALPHA.md §"반드시 지킬 전제" #1 (같은 내용을 담고 있음) - "HANDOFF §① t 2.16-2.97" → 문서 포인터 없이 숫자를 본문에 명시(자체 완결). MULTI_ALPHA에 그 범위가 그대로 있진 않아 가리키면 거짓이 되므로. 생성기(pead_refinement.py)와 생성물(PEAD_REFINEMENT_RESULTS.md)을 동일하게 수정 — 스크립트 재실행이 문서를 되돌리지 않도록. 내용은 MULTI_ALPHA.md가 승계: 분할조정 caveat, 세 슬리브 규칙, 성과, 정직한 한계. git 히스토리에 원본 보존. 294개 테스트 통과, ruff 클린, 깨진 마크다운 링크 0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
매집 스크리너가 실제로 신호를 담고 있는지를 데이터로 보이고, README 커버에 올릴 시각화 3종을 추가합니다. 포트폴리오 가독성을 위한 변경입니다.
변경 사항
strategies/backtest.py— 형성구간(기본 12거래일)에서 점수화한 후보를 보유구간 실제 수익률로 평가. 순위상관(scipy 비의존, 순위변환 후 Pearson)·점수 분위별 평균 수익률 요약.kq-backtestCLI 제공.viz/portfolio.py— 매집 후보 랭킹 막대 + 점수↔수익률 2패널(산점도 + 분위별 막대).scripts/make_figures.py—docs/images/{ranking,backtest,candidate}.png재현 생성.tests/test_backtest.py— split·forward_returns·spearman·예외 5건.함께 잡은 버그
'거래소'/'코스닥'한글로 저장하는데 영문"KOSPI"와 비교해 전부 KOSDAQ 색으로 칠해지던 것 수정.*.png전역.gitignore가 README 이미지까지 잡아 GitHub에서 깨질 뻔한 것 →!docs/images/*.png예외.검증 결과 (2026-05-15~06-12, 19거래일)
ruff checkclean🤖 Generated with Claude Code